package com.bw.service;

import com.bw.dao.UserDao;
import com.bw.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/***************************
 FileAction:

 CreateTime:2022-07-29 13:52
 Author:Aaking-aline
 ****************************/
@Service
public class UserService {
	@Autowired
	private UserDao userDao;

	public boolean register(User user){
		List<User> list = userDao.selectUserByUsernameAndPassword(user);
		if(list.isEmpty()){
			userDao.insertUser(user);
			return true;
		}
		return false;
	}

	public boolean login(User user){
		List<User> list = userDao.selectUserByUsernameAndPassword(user);
		if(list.isEmpty()){
			return false;
		}
		return true;
	}

}
